package org.train.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.train.dao.ProjectDao;
import org.train.dao.ReportDao;
import org.train.entity.ReportPo;
import org.train.util.R;
import org.train.util.RUtil;

import java.util.ArrayList;
import java.util.List;

@Service
public class ReportService extends ServiceImpl<ReportDao, ReportPo>{

    @Autowired
    private ProjectDao pd;
    @Autowired
    private ReportDao rd;

    public R queryAllInfos(Integer pageNum, Integer pageSize, String search){
        List<ReportPo> result = new ArrayList<>();
        Page<ReportPo> page = rd.queryAllInfos(new Page<ReportPo>(pageNum, pageSize,false), search);
        result = page.getRecords();
        return RUtil.success(result);
    }

    public R queryDetail(Integer id){
        return RUtil.success(rd.queryDetail(id));
    }
}